<?php
/**
 * Copyright (C) 2009  Graham Anderson
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

// Turn off xdebug exception stack trace
ini_set('xdebug.show_exception_trace', 0);

// PHPUnit
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Framework/IncompleteTestError.php';
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/Runner/Version.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Util/Filter.php';

// Match ZF coding standard
error_reporting( E_ALL | E_STRICT );

// define dirs
//$madoquaRootDir     = dirname(__FILE__) . '/../..';
define ('MADOQUA_ROOT', dirname(__FILE__) . '/../..');
define ('MADOQUA_APP_DIR', MADOQUA_ROOT . DIRECTORY_SEPARATOR . 'madoqua_private/application');
define ('MADOQUA_LIB_DIR', MADOQUA_ROOT . DIRECTORY_SEPARATOR . 'madoqua_private/library');
define ('MADOQUA_TESTS_DIR', MADOQUA_ROOT . DIRECTORY_SEPARATOR . 'madoqua_private/tests');


// exclude tests & ZF from code coverage
PHPUnit_Util_Filter::addDirectoryToFilter(MADOQUA_LIB_DIR . DIRECTORY_SEPARATOR . 'HtmlPurifier');
PHPUnit_Util_Filter::addDirectoryToFilter(MADOQUA_APP_DIR);
PHPUnit_Util_Filter::addDirectoryToFilter(MADOQUA_LIB_DIR . DIRECTORY_SEPARATOR . 'Zend');


// include path
set_include_path(
    MADOQUA_LIB_DIR . PATH_SEPARATOR .
    MADOQUA_TESTS_DIR   . PATH_SEPARATOR .
    get_include_path()
);

// Help loading classes
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

// Always run metrics for library and app dir
PHPUnit_Util_Filter::addDirectoryToWhitelist(MADOQUA_LIB_DIR . DIRECTORY_SEPARATOR . 'Madoqua');

// Some needed globals
$_SERVER['HTTP_HOST'] = "foo.bar.com";

//unset($madoquaRootDir);